/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.cip.esymons.tramite.bc;

import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

import org.cip.esymons.tramite.be.Operacion;
import org.cip.esymons.tramite.be.Transaccion;

/**
 *
 * @author ChristianATE
 */
public class OperacionDelegate {

    private OperacionFacadeLocal local;

    public OperacionDelegate() {
        local=lookupOperacionFacade();
    }
    
    public void create(Operacion operacion)
    {
        local.create(operacion);
    }

    public void AprobarDocExt(Operacion op){
        local.AprobarDocExt(op);
    }

    public void edit(Operacion operacion)
    {
        local.edit(operacion);
    }

    public void remove(Operacion operacion)
    {
        local.remove(operacion);
    }

    public Operacion find(Long id)
    {
        return local.find(id);
    }

    public List<Operacion> findAll()
    {
        return local.findAll();
    }

    public List<Operacion> listarArchExterXEmpleado(Long empl) {
        return local.listarArchExterXEmpleado(empl);
    }

    public List<Operacion> listarExterXEmpleado(Long empl) {
        return local.listarExterXEmpleado(empl);
    }

    public Operacion buscarXTransaccion(Transaccion tra, Long res) {
        return local.buscarXTransaccion(tra, res);
    }

    public Operacion crearOperacion(Transaccion tran){
        return local.crearOperacion(tran);
    }

    public void generarOperaciones(Transaccion tran){
        local.generarOperaciones(tran);
    }
    
    public Operacion buscarXTransaccion(Transaccion tra){
        return local.buscarXTransaccion(tra);
    }

    public void Aprobar(Transaccion trans){
        local.Aprobar(trans);
    }

    private OperacionFacadeLocal lookupOperacionFacade() {
        try {
            Context c = new InitialContext();
            return (OperacionFacadeLocal) c.lookup("java:comp/env/OperacionFacade");
        } catch (NamingException ne) {
            Logger.getLogger(getClass().getName()).log(Level.SEVERE, "exception caught", ne);
            throw new RuntimeException(ne);
        }
    }

}
